#ifndef __WAVSTREAM_H__
#define __WAVSTREAM_H__

#include "stream.h"

#define WAVSTREAM_CAST(x) ((WavStream *)(x))

typedef struct _WavStream
{
  Stream stream;

  Stream *out_stream;
  int data_chunk_offset;
  int sample_size;
} WavStream;

void wavstream_create (WavStream *ws, Stream *out_stream, short num_channels,
                       int samples_per_sec, short bits_per_sample);
/* Returns the offset from SeekSet to audio data in the data chunk
 * or -1 if there is none */
int wavstream_audio_data (WavStream *ws);

static void wavstream_write (Stream *s, void *src, int size);
static int wavstream_read (Stream *s, void *dest, int num_read,
                           int dest_offset);
static void wavstream_seek (Stream *s, int offset, SeekWhence whence);
static int wavstream_pos (Stream *s);
static int wavstream_size (Stream *s);
static void wavstream_close (Stream *s);

#endif
